package com.control.servlet;

import com.dao.GoodsDao;
import com.model.Goods;
import com.model.User;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

public class goodsServlet extends HttpServlet {

    GoodsDao goodsDao = new GoodsDao();

    @Override
    public void init() throws ServletException {
        super.init();
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        req.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html;charset=utf-8");
        String action = req.getParameter("action");
        List<Goods> goods = goodsDao.getGoods_topSix();
        for(Goods good:goods){
            resp.getWriter().write(good.toString());
        }
    }
}
